(function(e){if(e.BX.ajax)return;var a=e.BX,t={},r={method:"GET",dataType:"html",timeout:0,async:true,processData:true,scriptsRunFirst:false,emulateOnload:true,skipAuthCheck:false,start:true,cache:true,preparePost:true,headers:false,lsTimeout:30,lsForce:false},s={},n=[],o={url_utf:/[^\034-\254]+/g,script_self:/\/bitrix\/js\/main\/core\/core(_ajax)*.js$/i,script_self_window:/\/bitrix\/js\/main\/core\/core_window.js$/i,script_self_admin:/\/bitrix\/js\/main\/core\/core_admin.js$/i,script_onload:/window.onload/g};a.ajax=function(e){var s,n;if(!e||!e.url||!a.type.isString(e.url)){return false}for(var u in t)if(typeof e[u]=="undefined")e[u]=t[u];t={};for(u in r)if(typeof e[u]=="undefined")e[u]=r[u];e.method=e.method.toUpperCase();if(!a.localStorage)e.lsId=null;if(a.browser.IsIE()){var l=o.url_utf.exec(e.url);if(l){do{e.url=e.url.replace(l,a.util.urlencode(l));l=o.url_utf.exec(e.url)}while(l)}}if(e.dataType=="json")e.emulateOnload=false;if(!e.cache&&e.method=="GET")e.url=a.ajax._uncache(e.url);if(e.method=="POST"){if(e.preparePost){e.data=a.ajax.prepareData(e.data)}else if(i(e.headers)==="application/json"){e.data=JSON.stringify(e.data)}}var c=true;if(e.lsId&&!e.lsForce){var f=a.localStorage.get("ajax-"+e.lsId);if(f!==null){c=false;var p=function(t){if(t.key=="ajax-"+e.lsId&&t.value!="BXAJAXWAIT"){var r=t.value,s=!!t.oldValue&&r==null;if(!s)a.ajax.__run(e,r);else if(e.onfailure)e.onfailure("timeout");a.removeCustomEvent("onLocalStorageChange",p)}};if(f=="BXAJAXWAIT"){a.addCustomEvent("onLocalStorageChange",p)}else{setTimeout((function(){p({key:"ajax-"+e.lsId,value:f})}),10)}}}if(c){e.xhr=a.ajax.xhr();if(!e.xhr)return;if(e.lsId){a.localStorage.set("ajax-"+e.lsId,"BXAJAXWAIT",e.lsTimeout)}if(a.Type.isFunction(e.onprogress)){a.bind(e.xhr,"progress",e.onprogress)}if(a.Type.isFunction(e.onprogressupload)&&e.xhr.upload){a.bind(e.xhr.upload,"progress",e.onprogressupload)}e.xhr.open(e.method,e.url,e.async);if(!e.skipBxHeader&&!a.ajax.isCrossDomain(e.url)){e.xhr.setRequestHeader("Bx-ajax","true")}if(e.method=="POST"&&e.preparePost){e.xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}if(typeof e.headers=="object"){for(u=0;u<e.headers.length;u++)e.xhr.setRequestHeader(e.headers[u].name,e.headers[u].value)}var d=false;var h=e.xhr.onreadystatechange=function(t){if(d)return;if(t==="timeout"){if(e.onfailure){e.onfailure("timeout","",e)}a.onCustomEvent(e.xhr,"onAjaxFailure",["timeout","",e]);e.xhr.onreadystatechange=a.DoNothing;e.xhr.abort();if(e.async){e.xhr=null}}else{if(e.xhr.readyState==4||t=="run"){s=a.ajax.xhrSuccess(e.xhr)?"success":"error";d=true;e.xhr.onreadystatechange=a.DoNothing;if(s=="success"){var r=!!e.skipAuthCheck||a.ajax.isCrossDomain(e.url)?false:e.xhr.getResponseHeader("X-Bitrix-Ajax-Status");if(!!r&&r=="Authorize"){if(e.onfailure){e.onfailure("auth",e.xhr.status,e)}a.onCustomEvent(e.xhr,"onAjaxFailure",["auth",e.xhr.status,e])}else{var n=e.xhr.responseText;if(e.lsId){a.localStorage.set("ajax-"+e.lsId,n,e.lsTimeout)}a.ajax.__run(e,n)}}else{if(e.onfailure){e.onfailure("status",e.xhr.status,e)}a.onCustomEvent(e.xhr,"onAjaxFailure",["status",e.xhr.status,e])}if(e.async){e.xhr=null}}}};if(e.async&&e.timeout>0){setTimeout((function(){if(e.xhr&&!d){h("timeout")}}),e.timeout*1e3)}if(e.start){e.xhr.send(e.data);if(!e.async){h("run")}}return e.xhr}};a.ajax.xhr=function(){if(e.XMLHttpRequest){try{return new XMLHttpRequest}catch(e){}}else if(e.ActiveXObject){try{return new e.ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(e){}try{return new e.ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(e){}try{return new e.ActiveXObject("Msxml2.XMLHTTP")}catch(e){}try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}throw new Error("This browser does not support XMLHttpRequest.")}return null};a.ajax.isCrossDomain=function(t,r){r=r||e.location;if(t.indexOf("//")===0){t=r.protocol+t}if(t.indexOf("http")!==0){return false}var s=e.document.createElement("a");s.href=t;return s.protocol!==r.protocol||s.hostname!==r.hostname||a.ajax.getHostPort(s.protocol,s.host)!==a.ajax.getHostPort(r.protocol,r.host)};a.ajax.getHostPort=function(e,a){var t=/:(\d+)$/.exec(a);if(t){return t[1]}else{if(e==="http:"){return"80"}else if(e==="https:"){return"443"}}return""};a.ajax.__prepareOnload=function(t,r){if(t.length>0){a.ajax["onload_"+r]=null;for(var s=0,n=t.length;s<n;s++){if(t[s].isInternal){t[s].JS=t[s].JS.replace(o.script_onload,"BX.ajax.onload_"+r)}}}a.CaptureEventsGet();a.CaptureEvents(e,"load")};a.ajax.__runOnload=function(t){if(null!=a.ajax["onload_"+t]){a.ajax["onload_"+t].apply(e);a.ajax["onload_"+t]=null}var r=a.CaptureEventsGet();if(r){for(var s=0;s<r.length;s++)r[s].apply(e)}};a.ajax.__run=function(e,t){if(!e.processData){if(e.onsuccess){e.onsuccess(t)}a.onCustomEvent(e.xhr,"onAjaxSuccess",[t,e])}else{t=a.ajax.processRequestData(t,e)}};a.ajax._onParseJSONFailure=function(e){this.jsonFailure=true;this.jsonResponse=e;this.jsonProactive=/^\[WAF\]/.test(e)};a.ajax.processRequestData=function(e,t){var r,s=[],n=[];switch(t.dataType.toUpperCase()){case"JSON":var o=t.xhr||{};a.addCustomEvent(o,"onParseJSONFailure",a.proxy(a.ajax._onParseJSONFailure,t));r=a.parseJSON(e,o);a.removeCustomEvent(o,"onParseJSONFailure",a.proxy(a.ajax._onParseJSONFailure,t));if(!!r&&a.type.isArray(r["bxjs"])){for(var i=0;i<r["bxjs"].length;i++){if(a.type.isNotEmptyString(r["bxjs"][i])){s.push({isInternal:false,JS:r["bxjs"][i],bRunFirst:t.scriptsRunFirst})}else{s.push(r["bxjs"][i])}}}if(!!r&&a.type.isArray(r["bxcss"])){n=r["bxcss"]}break;case"SCRIPT":s.push({isInternal:true,JS:e,bRunFirst:t.scriptsRunFirst});r=e;break;default:var u=a.processHTML(e,t.scriptsRunFirst);r=u.HTML;s=u.SCRIPT;n=u.STYLE;break}if(n.length>0){a.loadCSS(n)}let l=null;if(t.emulateOnload){l=parseInt(Math.random()*1e6);a.ajax.__prepareOnload(s,l)}const c=a.defer((function(){if(t.emulateOnload){a.ajax.__runOnload(l)}a.onCustomEvent(t.xhr,"onAjaxSuccessFinish",[t])}));try{if(!!t.jsonFailure){throw{type:"json_failure",data:t.jsonResponse,bProactive:t.jsonProactive}}t.scripts=s;a.ajax.processScripts(t.scripts,true);if(t.onsuccess){t.onsuccess(r)}a.onCustomEvent(t.xhr,"onAjaxSuccess",[r,t]);a.ajax.processScripts(t.scripts,false,c)}catch(e){if(t.onfailure)t.onfailure("processing",e);a.onCustomEvent(t.xhr,"onAjaxFailure",["processing",e,t])}};a.ajax.processScripts=function(e,t,r){var s=[],n="";r=r||a.DoNothing;for(var o=0,i=e.length;o<i;o++){if(typeof t!="undefined"&&t!=!!e[o].bRunFirst)continue;if(e[o].isInternal)n+=";"+e[o].JS;else s.push(e[o].JS)}s=a.util.array_unique(s);var u=n.length>0?function(){a.evalGlobal(n)}:a.DoNothing;if(s.length>0){a.load(s,(function(){u();r()}))}else{u();r()}};a.ajax.prepareData=function(e,t){var r="";if(a.type.isString(e))r=e;else if(null!=e){for(var s in e){if(e.hasOwnProperty(s)){if(r.length>0)r+="&";var n=a.util.urlencode(s);if(t)n=t+"["+n+"]";if(typeof e[s]=="object")r+=a.ajax.prepareData(e[s],n);else r+=n+"="+a.util.urlencode(e[s])}}}return r};a.ajax.xhrSuccess=function(e){return e.status>=200&&e.status<300||e.status===304||e.status===1223||e.status===0};a.ajax.Setup=function(e,a){a=!!a;for(var s in e){if(a)t[s]=e[s];else r[s]=e[s]}};a.ajax.replaceLocalStorageValue=function(e,t,r){if(!!a.localStorage)a.localStorage.set("ajax-"+e,t,r)};a.ajax._uncache=function(e){return e+((e.indexOf("?")!==-1?"&":"?")+"_="+(new Date).getTime())};a.ajax.get=function(e,t,r){if(a.type.isFunction(t)){r=t;t=""}t=a.ajax.prepareData(t);if(t){e+=(e.indexOf("?")!==-1?"&":"?")+t;t=""}return a.ajax({method:"GET",dataType:"html",url:e,data:"",onsuccess:r})};a.ajax.getCaptcha=function(e){return a.ajax.loadJSON("/bitrix/tools/ajax_captcha.php",e)};a.ajax.insertToNode=function(e,r){r=a(r);if(!!r){var s={cancel:false};a.onCustomEvent("onAjaxInsertToNode",[{url:e,node:r,eventArgs:s}]);if(s.cancel===true){return}var n=null;if(!t.denyShowWait){n=a.showWait(r);delete t.denyShowWait}return a.ajax.get(e,(function(e){r.innerHTML=e;a.closeWait(r,n)}))}};a.ajax.post=function(e,t,r){t=a.ajax.prepareData(t);return a.ajax({method:"POST",dataType:"html",url:e,data:t,onsuccess:r})};a.ajax.promise=function(e){var t=new a.Promise;e.onsuccess=function(e){t.fulfill(e)};e.onfailure=function(e,a,r){t.reject({reason:e,data:a,ajaxConfig:r,xhr:r.xhr})};var r=a.ajax(e);if(r){if(typeof e.onrequeststart==="function"){e.onrequeststart(r)}}else{t.reject({reason:"init",data:false})}return t};a.ajax.loadScriptAjax=function(e,t,r){if(a.type.isArray(e)){for(var n=0,i=e.length;n<i;n++){a.ajax.loadScriptAjax(e[n],t,r)}}else{var u=e.replace(/\.js\?.*/,".js");if(o.script_self.test(u))return;if(o.script_self_window.test(u)&&a.CWindow)return;if(o.script_self_admin.test(u)&&a.admin)return;if(typeof s[u]=="undefined"){if(!!r){s[u]="";return a.loadScript(e)}else{return a.ajax({url:e,method:"GET",dataType:"script",processData:true,emulateOnload:false,scriptsRunFirst:true,async:false,start:true,onsuccess:function(e){s[u]=e;if(t)t(e)}})}}else if(t){t(s[u])}}};a.ajax.loadJSON=function(e,t,r,s){if(a.type.isFunction(t)){s=r;r=t;t=""}t=a.ajax.prepareData(t);if(t){e+=(e.indexOf("?")!==-1?"&":"?")+t;t=""}return a.ajax({method:"GET",dataType:"json",url:e,onsuccess:r,onfailure:s})};var i=function(e){if(!a.Type.isArray(e)){return null}var t=e.filter((function(e){return e.name==="Content-Type"})).pop();return t?t.value:null};var u=function(e){var t=e.getParameters||{};if(a.type.isNotEmptyString(e.analyticsLabel)){t.analyticsLabel=e.analyticsLabel}else if(a.type.isNotEmptyObject(e.analyticsLabel)){t.analyticsLabel=e.analyticsLabel}if(typeof e.mode!=="undefined"){t.mode=e.mode}if(e.navigation){if(e.navigation.page){t.nav="page-"+e.navigation.page}if(e.navigation.size){if(t.nav){t.nav+="-"}else{t.nav=""}t.nav+="size-"+e.navigation.size}}return t};var l=function(e){e=a.type.isPlainObject(e)?e:{};e.headers=e.headers||[];e.headers.push({name:"X-Bitrix-Csrf-Token",value:a.bitrix_sessid()});if(a.message.SITE_ID){e.headers.push({name:"X-Bitrix-Site-Id",value:a.message.SITE_ID})}if(typeof e.json!=="undefined"){if(!a.type.isPlainObject(e.json)){throw new Error("Wrong `config.json`, plain object expected.")}e.headers.push({name:"Content-Type",value:"application/json"});e.data=e.json;e.preparePost=false}else if(e.data instanceof FormData){e.preparePost=false;if(typeof e.signedParameters!=="undefined"){e.data.append("signedParameters",e.signedParameters)}}else if(a.type.isPlainObject(e.data)||a.Type.isNil(e.data)){e.data=a.type.isPlainObject(e.data)?e.data:{};if(typeof e.signedParameters!=="undefined"){e.data.signedParameters=e.signedParameters}}if(!e.method){e.method="POST"}return e};var c=function(e,t){t=t||false;var r=a.clone(e);var s=null;var n=e.onrequeststart;e.onrequeststart=function(e){s=e;if(a.type.isFunction(n)){n(e)}};var o=r.onrequeststart;r.onrequeststart=function(e){s=e;if(a.type.isFunction(o)){o(e)}};var i=a.ajax.promise(e);return i.then((function(e){if(!t&&a.type.isPlainObject(e)&&a.type.isArray(e.errors)){var s=false;e.errors.forEach((function(e){if(e.code==="invalid_csrf"&&e.customData.csrf){a.message({bitrix_sessid:e.customData.csrf});r.headers=r.headers||[];r.headers=r.headers.filter((function(e){return e&&e.name!=="X-Bitrix-Csrf-Token"}));r.headers.push({name:"X-Bitrix-Csrf-Token",value:a.bitrix_sessid()});s=true}}));if(s){return c(r,true)}}if(!a.type.isPlainObject(e)||e.status!=="success"){var n=new a.Promise;n.reject(e);return n}return e})).catch((function(e){var t=new a.Promise;var r;if(a.type.isPlainObject(e)&&e.xhr&&e.xhr.responseText){try{r=JSON.parse(e.xhr.responseText);e=r}catch(e){}}if(a.type.isPlainObject(e)&&e.status&&e.hasOwnProperty("data")){t.reject(e)}else{t.reject({status:"error",data:{ajaxRejectData:e},errors:[{code:"NETWORK_ERROR",message:"Network error"}]})}return t})).then((function(e){var t=new a.Promise;var r=s.getAllResponseHeaders().trim().split(/[\r\n]+/);var n={};r.forEach((function(e){var a=e.split(": ");var t=a.shift().toLowerCase();n[t]=a.join(": ")}));if(!n["x-process-assets"]){t.fulfill(e);return t}var o=a.prop.getObject(a.prop.getObject(e,"data",{}),"assets",{});var i=new Promise((function(e,t){var r=a.prop.getArray(o,"css",[]);a.load(r,(function(){a.loadScript(a.prop.getArray(o,"js",[]),e)}))}));i.then((function(){var r=a.prop.getArray(o,"string",[]);var s=r.join("\n");a.html(document.head,s,{useAdjacentHTML:true}).then((function(){t.fulfill(e)}))}));return t}))};a.ajax.runAction=function(e,t){t=l(t);var r=u(t);r.action=e;var s="/bitrix/services/main/ajax.php?"+a.ajax.prepareData(r);return c({method:t.method,dataType:"json",url:s,data:t.data,timeout:t.timeout,preparePost:t.preparePost,headers:t.headers,onrequeststart:t.onrequeststart,onprogress:t.onprogress,onprogressupload:t.onprogressupload})};a.ajax.runComponentAction=function(e,t,r){r=l(r);r.mode=r.mode||"ajax";var s=u(r);s.c=e;s.action=t;var n="/bitrix/services/main/ajax.php?"+a.ajax.prepareData(s);return c({method:r.method,dataType:"json",url:n,data:r.data,timeout:r.timeout,preparePost:r.preparePost,headers:r.headers,onrequeststart:r.onrequeststart?r.onrequeststart:null,onprogress:r.onprogress,onprogressupload:r.onprogressupload})};a.ajax.load=function(e,t){if(!a.type.isArray(e))e=[e];var r=0;if(!a.type.isFunction(t))t=a.DoNothing;var s=function(e){if(a.type.isFunction(this.callback))this.callback(e);if(++r>=o)t()};for(var n=0,o=e.length;n<o;n++){switch(e[n].type.toUpperCase()){case"SCRIPT":a.loadScript([e[n].url],a.proxy(s,e[n]));break;case"CSS":a.loadCSS([e[n].url]);if(++r>=o)t();break;case"JSON":a.ajax.loadJSON(e[n].url,a.proxy(s,e[n]));break;default:a.ajax.get(e[n].url,"",a.proxy(s,e[n]));break}}};a.ajax.submit=function(e,t){if(!e.target){if(null==e.BXFormTarget){var r="formTarget_"+Math.random();e.BXFormTarget=document.body.appendChild(a.create("IFRAME",{props:{name:r,id:r,src:"javascript:void(0)"},style:{display:"none"}}))}e.target=e.BXFormTarget.name}e.BXFormCallback=t;a.bind(e.BXFormTarget,"load",a.proxy(a.ajax._submit_callback,e));a.submit(e);return false};a.ajax.submitComponentForm=function(t,r,s){if(!t.target){if(null==t.BXFormTarget){var n="formTarget_"+Math.random();t.BXFormTarget=document.body.appendChild(a.create("IFRAME",{props:{name:n,id:n,src:"javascript:void(0)"},style:{display:"none"}}))}t.target=t.BXFormTarget.name}if(!!s)var o=a.showWait(r);t.BXFormCallback=function(t){if(!!s)a.closeWait(o);var n=function(){if(!!e.bxcompajaxframeonload){setTimeout((function(){e.bxcompajaxframeonload();e.bxcompajaxframeonload=null}),10)}};a(r).innerHTML=t;a.onCustomEvent("onAjaxSuccess",[null,null,n])};a.bind(t.BXFormTarget,"load",a.proxy(a.ajax._submit_callback,t));return true};a.ajax._submit_callback=function(){try{if(this.BXFormTarget.contentWindow.location.href.indexOf("http")!=0)return}catch(e){return}if(this.BXFormCallback)this.BXFormCallback.apply(this,[this.BXFormTarget.contentWindow.document.body.innerHTML]);a.unbindAll(this.BXFormTarget)};a.ajax.prepareForm=function(e,a){a=!!a?a:{};var t,r,s,n=[],o=e.elements.length,i=0,u=0;if(!!e){for(t=0;t<o;t++){s=e.elements[t];if(s.disabled)continue;if(!s.type)continue;switch(s.type.toLowerCase()){case"text":case"textarea":case"password":case"number":case"hidden":case"select-one":n.push({name:s.name,value:s.value});u+=s.name.length+s.value.length;break;case"file":if(!!s.files){for(r=0;r<s.files.length;r++){i++;n.push({name:s.name,value:s.files[r],file:true});u+=s.files[r].size}}break;case"radio":case"checkbox":if(s.checked){n.push({name:s.name,value:s.value});u+=s.name.length+s.value.length}break;case"select-multiple":for(var l=0;l<s.options.length;l++){if(s.options[l].selected){n.push({name:s.name,value:s.options[l].value});u+=s.name.length+s.options[l].length}}break;default:break}}t=0;u=0;var c=a,f,p,d,h;while(t<n.length){var x=n[t].name.indexOf("[");if(h){c[n[t].name]={};c[n[t].name][h.replace(/\[|\]/gi,"")]=n[t].value;c=a;h=null;t++}else if(x==-1){c[n[t].name]=n[t].value;c=a;t++}else{f=n[t].name.substring(0,x);p=n[t].name.substring(x+1);d=p.indexOf("]");if(d==-1){if(!c[f])c[f]=[];c=a;t++}else if(d==0){if(!c[f])c[f]=[];c=c[f];n[t].name=""+c.length;if(p.substring(d+1).indexOf("[")===0)h=p.substring(0,d)+p.substring(d+1)}else{if(!c[f])c[f]={};c=c[f];n[t].name=p.substring(0,d)+p.substring(d+1)}}}}return{data:a,filesCount:i,roughSize:u}};a.ajax.submitAjax=function(t,r){r=r!==null&&typeof r=="object"?r:{};r.url=r["url"]||t.getAttribute("action");var s=r["data"]||{};r.data=a.ajax.prepareForm(t).data;for(var n in s){if(s.hasOwnProperty(n)){r.data[n]=s[n]}}if(!e["FormData"]){a.ajax(r)}else{var o=function(e){var a=Object.prototype.toString.call(e);return a=="[object File]"||a=="[object Blob]"},i=function(e,a,t){if(!!t&&typeof t=="object"&&!o(t)){for(var r in t){if(t.hasOwnProperty(r)){i(e,a==""?r:a+"["+r+"]",t[r])}}}else e.append(a,!!t?t:"")},u=function(e){var t={};if(null!=e){if(typeof e=="object"){for(var r in e){if(e.hasOwnProperty(r)){var s=a.util.urlencode(r);if(typeof e[r]=="object"&&e[r]["file"]!==true)t[s]=u(e[r]);else if(e[r]["file"]===true)t[s]=e[r]["value"];else t[s]=a.util.urlencode(e[r])}}}else t=a.util.urlencode(e)}return t},l=new e.FormData;if(r.method!=="POST"){r.data=a.ajax.prepareData(r.data);if(r.data){r.url+=(r.url.indexOf("?")!==-1?"&":"?")+r.data;r.data=""}}else{if(r.preparePost===true)r.data=u(r.data);i(l,"",r.data);r.data=l}r.preparePost=false;r.start=false;var c=a.ajax(r);if(!!r["onprogress"])c.upload.addEventListener("progress",(function(e){var a=null;if(e.lengthComputable&&(e.total||e["totalSize"])){a=e.loaded*100/(e.total||e["totalSize"])}r["onprogress"](e,a)}));c.send(l)}};a.ajax.UpdatePageData=function(e){if(e.TITLE)a.ajax.UpdatePageTitle(e.TITLE);if(e.WINDOW_TITLE||e.TITLE)a.ajax.UpdateWindowTitle(e.WINDOW_TITLE||e.TITLE);if(e.NAV_CHAIN)a.ajax.UpdatePageNavChain(e.NAV_CHAIN);if(e.CSS&&e.CSS.length>0)a.loadCSS(e.CSS);if(e.SCRIPTS&&e.SCRIPTS.length>0){var t=function(r,s,n){if(!!s&&a.type.isArray(s.scripts)){for(var o=0,i=e.SCRIPTS.length;o<i;o++){s.scripts.push({isInternal:false,JS:e.SCRIPTS[o]})}}else{a.loadScript(e.SCRIPTS,n)}a.removeCustomEvent("onAjaxSuccess",t)};a.addCustomEvent("onAjaxSuccess",t)}else{var r=function(e,t,s){if(a.type.isFunction(s)){s()}a.removeCustomEvent("onAjaxSuccess",r)};a.addCustomEvent("onAjaxSuccess",r)}};a.ajax.UpdatePageTitle=function(e){var t=a("pagetitle");if(t){a.remove(t.firstChild);if(!t.firstChild)t.appendChild(document.createTextNode(e));else t.insertBefore(document.createTextNode(e),t.firstChild)}};a.ajax.UpdateWindowTitle=function(e){document.title=e};a.ajax.UpdatePageNavChain=function(e){var t=a("navigation");if(t){t.innerHTML=e}};a.userOptions={options:null,bSend:false,delay:5e3,path:"/bitrix/admin/user_options.php?"};a.userOptions.setAjaxPath=function(e){a.userOptions.path=e.indexOf("?")==-1?e+"?":e+"&"};a.userOptions.save=function(e,t,r,s,n){if(null==a.userOptions.options)a.userOptions.options={};n=!!n;a.userOptions.options[e+"."+t+"."+r]=[e,t,r,s,n];var o=a.userOptions.__get();if(o!="")document.cookie=a.message("COOKIE_PREFIX")+"_LAST_SETTINGS="+encodeURIComponent(o)+"&sessid="+a.bitrix_sessid()+"; expires=Thu, 31 Dec "+((new Date).getFullYear()+1)+" 23:59:59 GMT; path=/;";if(!a.userOptions.bSend){a.userOptions.bSend=true;setTimeout((function(){a.userOptions.send(null)}),a.userOptions.delay)}};a.userOptions.send=function(e){var t=a.userOptions.__get();a.userOptions.options=null;a.userOptions.bSend=false;if(t!=""){document.cookie=a.message("COOKIE_PREFIX")+"_LAST_SETTINGS=; path=/;";a.ajax({method:"GET",dataType:"html",processData:false,cache:false,url:a.userOptions.path+t+"&sessid="+a.bitrix_sessid(),onsuccess:e})}};a.userOptions.del=function(e,t,r,s){a.ajax.get(a.userOptions.path+"action=delete&c="+e+"&n="+t+(r==true?"&common=Y":"")+"&sessid="+a.bitrix_sessid(),s)};a.userOptions.__get=function(){if(!a.userOptions.options)return"";var e="",t=-1,r="",s,n;for(n in a.userOptions.options){if(a.userOptions.options.hasOwnProperty(n)){s=a.userOptions.options[n];if(r!=s[0]+"."+s[1]){t++;e+="&p["+t+"][c]="+a.util.urlencode(s[0]);e+="&p["+t+"][n]="+a.util.urlencode(s[1]);if(s[4]==true)e+="&p["+t+"][d]=Y";r=s[0]+"."+s[1]}var o=s[2];var i=s[3];if(o===null){e+="&p["+t+"][v]="+a.util.urlencode(i)}else{e+="&p["+t+"][v]["+a.util.urlencode(o)+"]="+a.util.urlencode(i)}}}return e.substr(1)};a.ajax.history={expected_hash:"",obParams:null,obFrame:null,obImage:null,obTimer:null,bInited:false,bHashCollision:false,bPushState:!!(history.pushState&&a.type.isFunction(history.pushState)),startState:null,init:function(t){if(a.ajax.history.bInited)return;this.obParams=t;var r=this.obParams.getState();if(a.ajax.history.bPushState){a.ajax.history.expected_hash=e.location.pathname;if(e.location.search)a.ajax.history.expected_hash+=e.location.search;a.ajax.history.put(r,a.ajax.history.expected_hash,"",true);setTimeout((function(){a.bind(e,"popstate",a.ajax.history.__hashListener)}),500)}else{a.ajax.history.expected_hash=e.location.hash;if(!a.ajax.history.expected_hash||a.ajax.history.expected_hash=="#")a.ajax.history.expected_hash="__bx_no_hash__";f.put(a.ajax.history.expected_hash,r);a.ajax.history.obTimer=setTimeout(a.ajax.history.__hashListener,500);if(a.browser.IsIE()){a.ajax.history.obFrame=document.createElement("IFRAME");a.hide_object(a.ajax.history.obFrame);document.body.appendChild(a.ajax.history.obFrame);a.ajax.history.obFrame.contentWindow.document.open();a.ajax.history.obFrame.contentWindow.document.write(a.ajax.history.expected_hash);a.ajax.history.obFrame.contentWindow.document.close()}else if(a.browser.IsOpera()){a.ajax.history.obImage=document.createElement("IMG");a.hide_object(a.ajax.history.obImage);document.body.appendChild(a.ajax.history.obImage);a.ajax.history.obImage.setAttribute("src","javascript:location.href = 'javascript:BX.ajax.history.__hashListener();';")}}a.ajax.history.bInited=true},__hashListener:function(t){t=t||e.event||{state:false};if(a.ajax.history.bPushState){a.ajax.history.obParams.setState(t.state||a.ajax.history.startState)}else{if(a.ajax.history.obTimer){e.clearTimeout(a.ajax.history.obTimer);a.ajax.history.obTimer=null}var r;if(null!=a.ajax.history.obFrame)r=a.ajax.history.obFrame.contentWindow.document.body.innerText;else r=e.location.hash;if(!r||r=="#")r="__bx_no_hash__";if(r.indexOf("#")==0)r=r.substring(1);if(r!=a.ajax.history.expected_hash){var s=f.get(r);if(s){a.ajax.history.obParams.setState(s);a.ajax.history.expected_hash=r;if(null!=a.ajax.history.obFrame){var n=r=="__bx_no_hash__"?"":r;if(e.location.hash!=n&&e.location.hash!="#"+n)e.location.hash=n}}}a.ajax.history.obTimer=setTimeout(a.ajax.history.__hashListener,500)}},put:function(t,r,s,n){if(this.bPushState){if(!n){history.pushState(t,"",r)}else{a.ajax.history.startState=t}}else{if(typeof s!="undefined")r=s;else r="view"+r;f.put(r,t);a.ajax.history.expected_hash=r;e.location.hash=a.util.urlencode(r);if(null!=a.ajax.history.obFrame){a.ajax.history.obFrame.contentWindow.document.open();a.ajax.history.obFrame.contentWindow.document.write(r);a.ajax.history.obFrame.contentWindow.document.close()}}},checkRedirectStart:function(t,r){var s=e.location.hash;if(s.substring(0,1)=="#")s=s.substring(1);var n=s.substring(0,5);if(n=="view/"||n=="view%"){a.ajax.history.bHashCollision=true;document.write("<"+'div id="__ajax_hash_collision_'+r+'" style="display: none;">')}},checkRedirectFinish:function(t,r){document.write("</div>");var s=e.location.hash;if(s.substring(0,1)=="#")s=s.substring(1);a.ready((function(){var e=s.substring(0,5);if(e=="view/"||e=="view%"){var n=a("__ajax_hash_collision_"+r);var o=n.firstChild;a.cleanNode(o);n.style.display="block";if(e!="view%")s=a.util.urlencode(s);s+=(s.indexOf("%3F")==-1?"%3F":"%26")+t+"="+r;var i="/bitrix/tools/ajax_redirector.php?hash="+s;a.ajax.insertToNode(i,o)}}))}};a.ajax.component=function(e){this.node=e};a.ajax.component.prototype.getState=function(){var t={node:this.node,title:e.document.title,data:a(this.node).innerHTML};var r=a("navigation");if(null!=r)t.nav_chain=r.innerHTML;a.onCustomEvent(a(t.node),"onComponentAjaxHistoryGetState",[t]);return t};a.ajax.component.prototype.setState=function(e){a(e.node).innerHTML=e.data;a.ajax.UpdatePageTitle(e.title);if(e.nav_chain){a.ajax.UpdatePageNavChain(e.nav_chain)}a.onCustomEvent(a(e.node),"onComponentAjaxHistorySetState",[e])};var f={arHistory:{},put:function(e,a){this.arHistory[e]=a},get:function(e){return this.arHistory[e]}};a.ajax.FormData=function(){this.elements=[];this.files=[];this.features={};this.isSupported();this.log("BX FormData init")};a.ajax.FormData.isSupported=function(){var e=new a.ajax.FormData;var t=e.features.supported;e=null;return t};a.ajax.FormData.prototype.log=function(e){if(false){try{if(a.browser.IsIE())e=JSON.stringify(e);console.log(e)}catch(e){}}};a.ajax.FormData.prototype.isSupported=function(){var a={};a.fileReader=e.FileReader&&e.FileReader.prototype.readAsBinaryString;a.readFormData=a.sendFormData=!!e.FormData;a.supported=!!(a.readFormData&&a.sendFormData);this.features=a;this.log("features:");this.log(a);return a.supported};a.ajax.FormData.prototype.append=function(e,a){if(typeof a==="object"){this.files.push({name:e,value:a})}else{this.elements.push({name:e,value:a})}};a.ajax.FormData.prototype.send=function(e,t,r,s){this.log("FD send");this.xhr=a.ajax({method:"POST",dataType:"html",url:e,onsuccess:t,onfailure:s,start:false,preparePost:false});if(r){this.xhr.upload.addEventListener("progress",(function(e){if(e.lengthComputable)r(e.loaded/(e.total||e.totalSize))}),false)}if(this.features.readFormData&&this.features.sendFormData){var n=new FormData;this.log("use browser formdata");for(var o in this.elements){if(this.elements.hasOwnProperty(o))n.append(this.elements[o].name,this.elements[o].value)}for(o in this.files){if(this.files.hasOwnProperty(o))n.append(this.files[o].name,this.files[o].value)}this.xhr.send(n)}return this.xhr};a.addCustomEvent("onAjaxFailure",a.debug)})(window);
//# sourceMappingURL=core_ajax.map.js